﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Layout/SiteNoHead.master"
	AutoEventWireup="true" CodeBehind="EditProduct.aspx.cs" Inherits="IService.Admin.Pages.EditProduct" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	产品编辑
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
	<base target="_self" />
	<link href="../uploadify/uploadify.css" rel="stylesheet" type="text/css" />
	<link href="../Style/zTreeStyle.css" rel="stylesheet" type="text/css" />
	<script src="../uploadify/swfobject.js" type="text/javascript"></script>
	<script src="../uploadify/jquery.uploadify.v2.1.4.min.js" type="text/javascript"></script>
	<script src="../Script/jquery.ztree.core-3.0.min.js" type="text/javascript"></script>
	<script src="../Script/jquery.ztree.exedit-3.0.min.js" type="text/javascript"></script>
	<script src="../Script/jquery.ztree.excheck-3.0.min.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(function ()
		{
			$('#fileupload').uploadify({
				'uploader': '../uploadify/uploadify.swf',
				'script': '../../Handler/UploadHandler.ashx',
				'cancelImg': '../uploadify/cancel.png',
				'folder': '../../UploadFile/Activity',
				'queueID': 'fileQueue',
				'auto': false,
				'multi': false,
				'sizeLimit': 1024 * 1024,
				'simUploadLimit': 5,
				'fileExt': '*.jpg;*.gif;*.png',
				'fileDesc': 'Image Files',
				onComplete: ImageComplete,
				onError: function () { alert("图片上传失败！") }
			});
		});
		function ImageComplete(event, ID, fileObj, response, data)
		{
			alert("图片上传成功！");
			$("#<%=ArticlePic.ClientID %>").val(response);
			var obj = $("#<%=previewPic.ClientID %>");
			obj.show();
			obj.attr("src", response);
		}
		function checkInput()
		{
			var newsTitle = $("#<%=NewsTitle.ClientID %>").val().replace(' ', '');
			var createPeople = $("#<%=CreatePeople.ClientID %>").val().replace(' ', '');
			var ArticlePic = $("#<%=ArticlePic.ClientID %>").val().replace(' ', '');
			var errorLbl = $("#<%=LblError.ClientID %>");
			if (newsTitle == '')
			{
				errorLbl.html("<font color='red'>产品标题不能为空！</font>");
				return false;
			}else if (createPeople == '')
			{
				errorLbl.html("<font color='red'>发布人不能为空！</font>");
				return false;
			} else if (ArticlePic == '')
			{
			    errorLbl.html("<font color='red'>请上传产品主题图片！</font>");
				return false;
			}
			return true;
		}
	</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="SubTitle" runat="server">
	产品编辑
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
	<asp:Button runat="server" CssClass="button" Text="保存" OnClientClick="return checkInput();"
		ID="Button1" OnClick="BtnEditArticle_Click" />
	<table class="news_table" border="1">
		<thead>
			<tr>
				<th>
					产品标题：
				</th>
				<td>
					<asp:TextBox CssClass="newstxt" MaxLength="80" ID="NewsTitle" runat="server"></asp:TextBox>
					<span class="red">*</span>
					<asp:Label ID="LblError" runat="server"></asp:Label>
				</td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th>
					发布者：
				</th>
				<td>
					<asp:TextBox CssClass="newstxt" ReadOnly="true" ID="CreatePeople" runat="server"></asp:TextBox>
					<span class="red">*</span>
				</td>
			</tr>
			<tr>
				<th>
					主题图片：
				</th>
				<td>
					<asp:Image ID="previewPic" Width="131px" Height="80px" runat="server" />
					<div id="fileQueue">
					</div>
					<input id="fileupload" name="fileupload" type="file" />
					<p>
						<a href="javascript:$('#fileupload').uploadifyUpload();">上传</a> <a href="javascript:$('#fileupload').uploadifyClearQueue();">
							取消</a>
					</p>
					<asp:HiddenField ID="ArticlePic" runat="server" />
				</td>
			</tr>
			<tr>
				<th>
					产品内容：
				</th>
				<td>
					<CKEditor:CKEditorControl ID="newsContentCKeditor" runat="server">
					</CKEditor:CKEditorControl>
				</td>
			</tr>
			<tr>
				<th>
					保存：
				</th>
				<td>
					<asp:Button runat="server" CssClass="button" OnClientClick="return checkInput();"
						Text="保存" ID="BtnEditArticle" OnClick="BtnEditArticle_Click" />
				</td>
			</tr>
		</tbody>
	</table>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="MainBody" runat="server">
</asp:Content>
